package com.umeox.moto.watch.fitness.db.model;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

/**
 * Created by Rambo 2021/11/16
 * Describe:
 */
@Entity(tableName = TodayChallenge.TABLE_NAME)
public class TodayChallenge implements Parcelable {

    @Ignore
    public static final String TABLE_NAME = "today_challenge";

    /**
     * id : 1
     * sportType : 1
     * duration : 30
     * reminderTime : 12:00
     * rewardValue : 2
     */

    @PrimaryKey
    public long id;
    public int sportType;
    public int duration;
    public String reminderTime;
    public int rewardValue;
    public int isReminder; //是否已经提醒过 0：未提醒  1：已提醒
    @Ignore
    public String challengeTimesLevel;

    public TodayChallenge() {

    }


    protected TodayChallenge(Parcel in) {
        id = in.readLong();
        sportType = in.readInt();
        duration = in.readInt();
        reminderTime = in.readString();
        rewardValue = in.readInt();
        isReminder = in.readInt();
    }

    @Override
    public String toString() {
        return "ChallengeBean{" +
                "id=" + id +
                ", sportsType=" + sportType +
                ", duration=" + duration +
                ", reminderTime='" + reminderTime + '\'' +
                ", rewardValue=" + rewardValue +
                ", isReminder=" + isReminder +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(this.id);
        dest.writeInt(this.sportType);
        dest.writeInt(this.duration);
        dest.writeString(this.reminderTime);
        dest.writeInt(this.rewardValue);
        dest.writeInt(this.isReminder);
    }


    public static final Creator<TodayChallenge> CREATOR = new Creator<TodayChallenge>() {
        @Override
        public TodayChallenge createFromParcel(Parcel in) {
            return new TodayChallenge(in);
        }

        @Override
        public TodayChallenge[] newArray(int size) {
            return new TodayChallenge[size];
        }
    };
}
